import request from '@/config/axios'

// 跨境电商发货明细 VO
export interface OrderShipmentItemVO {
  id: number // 发货明细编号
  shipmentId: number // 发货编号
  shipmentNo: string // 发货单号
  orderItemId: number // 订单项编号
  skuId: number // SKU编号
  skuCode: string // SKU编码
  productName: string // 商品名称
  quantity: number // 发货数量
  weight: number // 重量（kg）
  volume: number // 体积（立方米）
  batchNo: string // 批次号
  serialNos: string // 序列号列表，逗号分隔
  locationCode: string // 库位编码
  packageNo: string // 包裹号
}

// 跨境电商发货明细 API
export const OrderShipmentItemApi = {
  // 查询跨境电商发货明细分页
  getOrderShipmentItemPage: async (params: any) => {
    return await request.get({ url: `/crossborder/order-shipment-item/page`, params })
  },

  // 查询跨境电商发货明细详情
  getOrderShipmentItem: async (id: number) => {
    return await request.get({ url: `/crossborder/order-shipment-item/get?id=` + id })
  },

  // 新增跨境电商发货明细
  createOrderShipmentItem: async (data: OrderShipmentItemVO) => {
    return await request.post({ url: `/crossborder/order-shipment-item/create`, data })
  },

  // 修改跨境电商发货明细
  updateOrderShipmentItem: async (data: OrderShipmentItemVO) => {
    return await request.put({ url: `/crossborder/order-shipment-item/update`, data })
  },

  // 删除跨境电商发货明细
  deleteOrderShipmentItem: async (id: number) => {
    return await request.delete({ url: `/crossborder/order-shipment-item/delete?id=` + id })
  },

  // 导出跨境电商发货明细 Excel
  exportOrderShipmentItem: async (params) => {
    return await request.download({ url: `/crossborder/order-shipment-item/export-excel`, params })
  },
}